home *** CD-ROM | disk | FTP | other *** search
- title TIMERT03 -- High Resolution Timer Test Skeleton
- page 60,120
-
- name TIMERT03 ; module
-
- comment | Module Specifications
-
- Copyright: None.
-
- Environment: IBM PC, tested under DOS 2.0.
-
- Segmentation: Program segment CODE, public, byte aligned, class ''.
- Stack segment STACK, stack, paragraph aligned, class ''.
- Data segment DATA, public, byte aligned, class ''.
-
- Public symbols and external references: See Symbols section of listing.
-
- Link requirements: EXE module, must be linked with TIMERS01 and TIMERR02,
- and any external code to be included in test.
-
- Program derived from: None.
-
- Original code by: Bob Smith and Tom Puckett, October 1983.
-
- Modifications by: None.
-
-
- Procedure Specifications
-
- Program TIMERT03 -- High Resolution Timer Test Program Skeleton
-
- This is the skeleton of a control routine to be used in running
- high resolution timing tests. The code to be tested is included
- in this module or called from it. This routine calls subroutines
- TIMERS01 and TIMERR02 for setting and reading Counter 0 of the 8253.
- It is normally run under DEBUG to allow a breakpoint to be set to
- examine the results of the timing test.
-
- Assumptions: None.
-
- Linkage: DOS command.
-
- Arguments: None.
-
- Effects: 8253 Counter 0 reset by routine TIMERS01.
-
- Results: None.
-
- Return conditions: None.
-
- Limitations: Gives incorrect results if test run spans midnight.
- |
- page
-
- stack segment stack para
-
- db 32 dup ('stack ') ; you may wish to increase this if
- ; the routine being tested makes
- stack ends ; heavy demands on the stack
-
-
-
- data segment public byte
-
- a_cal_high dw ? ; first timer readings...
- a_cal_low dw ?
- a_cal_ext dw ?
-
- b_cal_high dw ? ; second timer readings....
- b_cal_low dw ?
- b_cal_ext dw ?
-
- ; other storage needed by routine being tested can be included here...
-
- data ends
-
-
-
- code segment public byte
- assume cs:code
-
- extrn timers01:near ; 8253 Counter 0 set routine
- extrn timerr02:near ; 8253 Counter 0 read routine
-
- public TIMERT03
- TIMERT03 proc far ; see specifications at head of listing
-
- push ds ; make return linkage
- xor ax,ax
- push ax
- mov ax,data ; get data segment addressible
- mov ds,ax
- assume ds:data
- call tester ; do the work
- ret
-
- TIMERT03 endp
- page
-
- tester proc near
-
- call timers01 ; get 8253 counter 0 running in Mode 2
-
- call timerr02 ; begin calibration pass
- mov a_cal_ext,cx
- mov a_cal_low,bx
- mov a_cal_high,ax ; initial extended timer count now saved
-
- calib_begin:
- ; put here any test code whose effect is to be removed
- ; from the results, such as loop control statements...
- calib_end:
-
- call timerr02 ; end of calibration pass, begin test pass
- mov b_cal_ext,cx
- mov b_cal_low,bx
- mov b_cal_high,ax
-
- test_begin:
- ; put test code here...
- test_end:
-
- call timerr02 ; end of test pass
-
- add cx,a_cal_ext ; calculate (C-B)-(B-A) as ((C+A)-B)-B...
- adc bx,a_cal_low ; ADC to allow for carry in preceding ADD
- adc ax,a_cal_high ; now have C+A
-
- sub cx,b_cal_ext
- sbb bx,b_cal_low
- sbb ax,b_cal_high ; now have (C+A)-B
-
- sub cx,b_cal_ext
- sbb bx,b_cal_low
- sbb ax,b_cal_high ; now have ((C+A)-B)-B in timer counts as
- ; a six byte field in AX, BX, and CX
-
- halt: ; put DEBUG breakpoint here to examine results
- ret
-
- tester endp
-
- code ends
-
- end TIMERT03